package com.belizer.demo.process;

import java.io.InputStream;
import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        Runtime run = Runtime.getRuntime();

        Process process = null;
        StringBuffer stringBuffer = new StringBuffer();
        try {
            process = run.exec("ipconfig");
            process.waitFor();
            InputStream inputStream = process.getInputStream();
            Scanner input = new Scanner(inputStream,"gbk");
            while (input.hasNextLine()){
                stringBuffer.append(input.nextLine());
            }
            System.out.println(stringBuffer.toString());
            process.destroy();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
